Repository navigation
[3.x] Release package (rc) - #294
Merged
Merged
Conversation
codama-releases
Bot
force-pushed
the
changeset-release/main
branch
4 times, most recently
from
November 13, 2026 12:28
98bdaf8 to
9b673be
Compare
codama-releases
Bot
force-pushed
the
changeset-release/main
branch
10 times, most recently
from
November 25, 2026 17:07
ffb5c40 to
abcc0a4
Compare
codama-releases
Bot
force-pushed
the
changeset-release/main
branch
from
November 26, 2026 13:34
abcc0a4 to
d6e1f47
Compare
codama-releases
Bot
force-pushed
the
changeset-release/main
branch
from
November 27, 2026 07:53
d6e1f47 to
9a56294
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
mainis currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, runchangeset pre exitonmain.Releases
@codama/renderers-js@3.0.0-rc.0
Major Changes
#306
5438525Thanks @lorisleiva! - Require Node.js 22.12.0 or later, as Codama v2 does.BREAKING CHANGES
Node.js 20 is no longer supported. The package now declares
"engines": { "node": ">=22.12.0" }, the first Node.js 22 release that supportsrequire(esm)by default. Node.js 20 reached its end of life in April 2026. This only concerns the environment running the renderer: generated clients are unaffected.#343
7e094e0Thanks @lorisleiva! - Forward the program address of instructions to PDAs pinned to the address of their own program, as program plugins already do, so that they follow a program deployed at another address.#294
2fad86fThanks @codama-releases! - Start major 3. Release candidates publish under thercdist-tag while this major is in development.#329
b9d3506Thanks @lorisleiva! - Report invalid IDLs withCodamaErrors and document every export of the renderer.BREAKING CHANGES
The
discriminatedUnionDiscriminatorname transformer receives the identifier of the node owning the union. It receives the identifier of the defined type, account, event or instruction as written in the IDL, e.g.my_point, rather than the camelCase form of its data type, e.g.myPoint. Unions of events receive the event identifier, e.g.pingedrather thanpingedEvent, and unions nested within another type receive an empty name instead of their parent's. The default transformer is unaffected.Invalid references throw
CodamaErrors. Data fields and extra arguments sharing a name throwCODAMA_ERROR__RENDERERS__UNSUPPORTED_NODEinstead of a plainError, resolver dependencies must beaccounts.<identifier>ordata.<path>references, e.g.data.config.fees[0], and field discriminators referring to a missing field or one without a default value throw instead of leaving out their constant.Dependency ranges that are not semver ranges, such as
workspace:*, are kept as they are when syncing thepackage.json, without a warning.#347
5956c19Thanks @lorisleiva! - Fix generated code that did not compile or behaved incorrectly in edge cases.BREAKING CHANGES
Parse functions compare omitted optional accounts with the program address of the instruction. Instructions built with a custom
programAddressfill in their omitted optional accounts with that address, so their parse functions now compare againstinstruction.programAddressrather than the address declared in the IDL, which reported those accounts as present.Account type parameters default to the address the builder fills in. An account defaulting to an injected value that resolves to a program or public key now defaults to that address, e.g.
TAccountTokenProgram extends string = '...', whilst an account resolved by a resolver defaults tostringeven when it also declares a public key default, since the resolver provides its value.Recursive defined types listed in
internalNodesno longer import themselves, constants nesting a data union value within a struct or map are typed as their loose type, negative enum discriminators render as computed keys undererasableSyntax, and theargsof builders no longer redeclare the omitted fields the input already requires.#307
5acb331Thanks @lorisleiva! - Render IDLs of the Codama v2 standard. The renderer now depends on the v2 releases of@codama/nodes,@codama/visitors-coreand@codama/errors, and on@codama/fragmentsinstead of@codama/renderers-core.BREAKING CHANGES
Codama v2 IDLs are required. The renderer only accepts trees of the v2 standard, and rendering a root node whose
versionis not a 2.x version throwsCODAMA_ERROR__VERSION_MISMATCH. Upgrade v1 IDLs with thecodama upgradecommand, or with theupgradefunction orupgradeToLatestVisitorof@codama/upgrade, e.g. as abeforevisitor of your Codama configuration.{ "idl": "program/idl.json", "before": ["@codama/upgrade"], "scripts": { "js": { "from": "@codama/renderers-js", "args": ["clients/js"] } } }Names are derived from the spec's word split. Node identifiers keep their original casing in v2, and every generated name is derived from the words of the identifier as the spec defines them, through the casing helpers of
@codama/fragments/casing. Identifiers made of consecutive capitals now keep acronyms as single words, e.g.getURLbecomesgetUrlrather thangetURL.References within the IDL match identifiers exactly. Data paths, resolver dependencies, field discriminators, PDA seed values and remaining accounts backed by a data field find their target by its exact identifier, as Codama core does. Option keys referencing nodes, such as
linkOverridesorinternalNodes, are compared by their camelCase form.Unrenderable nodes report their path. Errors thrown for nodes that cannot be rendered carry the
pathof the node in their context instead of the node itself, as Codama v2 errors do, and nodes visited outside of a program throwCODAMA_ERROR__NODE_PATH_PROGRAM_MISSING.Data paths entering the data of a linked account, e.g.
mint.data.decimals, throwCODAMA_ERROR__RENDERERS__UNSUPPORTED_NODE, since instruction builders only receive account addresses, and data paths that do not exist throwCODAMA_ERROR__CANNOT_RESOLVE_PATH.#308
d93b590Thanks @lorisleiva! - Render the type nodes of the Codama v2 standard. Integers and floats render with the same codecs as v1 numbers, and integer values that a JavaScript number cannot represent exactly render asbigintliterals. Fixed points render as their underlying integer, except SOL amounts (a scale of 9 with aSOLunit), which keep rendering asLamports, and date-times and durations render as their underlying integer. Thetransformsof a type node wrap its codecs in order, the first being the innermost, as the v1 wrapper type nodes did, and sentinel counts render as sentinel-sized arrays, sets and maps.Enum variants render as before when they carry no data, a struct or a tuple, following defined type links to their target. A variant holding a struct through a link spreads its fields, e.g.
{ __kind: 'At' } & Point, a variant holding a tuple through a link exposes it as itsfields, and a variant holding any other single type exposes it as a one-itemfieldstuple, e.g.{ __kind: 'Amount'; fields: readonly [bigint] }, which encodes to the same bytes. Enum values of such variants pass their value as a one-item tuple, e.g.command('Amount', [42]).Struct field defaults injected from a provider are filled in by instruction builders before encoding. The codec of the struct only fills in their
fallback, when one is given and no value was, so such fields are optional in the input type of the codec when they have a fallback and required otherwise, as v1 instruction arguments with contextual defaults were.#328
b12a2b7Thanks @lorisleiva! - Render instruction builders that previously produced code failing to compile or behaving incorrectly.BREAKING CHANGES
Default values only fill in missing arguments. Builders check
args.amount === undefinedinstead of!args.amount, so given falsy values such as0orfalseare no longer replaced by their default.Data arguments defaulting to the payer or the identity are required by instruction builders. Builders have no payer or identity to fill them in with, so their input types require them. The program plugin keeps filling in the payer of its client.
The program plugin exposes the instructions rendered as pages. Programs with sub-instructions expose their leaf instructions, along with their parents when
renderParentInstructionsis enabled, instead of their top-level instructions only.Inline PDA defaults missing a seed value throw. They throw
CODAMA_ERROR__VISITORS__INVALID_PDA_SEED_VALUESinstead of deriving another address without that seed.Byte deltas of accounts without a fixed size throw. A byte delta given by an account that has neither a
sizenor a fixed data size throwsCODAMA_ERROR__RENDERERS__UNSUPPORTED_NODE. Accounts whose data has a fixed size now get a size function, e.g.getCounterSize(), even without a declaredsize.Builders also declare the arguments they fill in when every argument is omitted, pass extra arguments to the resolvers of remaining accounts and byte deltas, and fill in the defaults of arguments read by byte deltas. The data of sub-instructions can be extracted with the
customInstructionDataoption, and PDA seeds reading an account and a data field of the same name keep both dependencies.#342
57e088aThanks @lorisleiva! - Fix generated code that did not compile or behaved incorrectly in edge cases.BREAKING CHANGES
Internal nodes are not exposed by the program plugin. Accounts, instructions and PDAs listed in
internalNodesare left out of the program plugin, as they are left out of barrels. Generated code using them, e.g. an instruction defaulting to an internal PDA, imports them from their own file, e.g.../pdas/secret-pda.Inputs that synchronous builders cannot fill in are required there. Data fields filled in by an asynchronous resolver, and omitted data fields defaulting to the payer or the identity, are required in the input of synchronous builders. Asynchronous builders and the program plugin keep filling them in.
Conditional default values compare their condition loosely or throw. Integer conditions are compared as
bigints, e.g.BigInt(args.amount) === 5n, account conditions by address, and conditions on values that cannot be compared with===, such as options or structs, throwCODAMA_ERROR__RENDERERS__UNSUPPORTED_NODE.Kit number codecs keep their names. The
encoderFunctionanddecoderFunctionname transformers no longer rename the number codecs imported from Kit, e.g.getU64Encoder, which only exist under those names.Field discriminators of data linked to a defined type are supported.
#349
0244cf4Thanks @lorisleiva! - Fix instruction builders whose data fields are named like an account and filled in by the builder.BREAKING CHANGES
Data fields defaulting to a PDA hold its address. Builders filling in a data field from a PDA assign the address of the derived PDA, e.g.
args.vault = (await findVaultPda(...))[0], rather than the[address, bump]pair returned by the find function, which did not match the type of the field.Such fields are only renamed in the input of the builder that requires them, e.g.
vaultArgin the synchronous builder, so asynchronous builders filling them in no longer read an input property that does not exist, and they leave the account of the same name out of the arguments they fill in.#339
e20f800Thanks @lorisleiva! - Render the docs, lifecycle status and return data of instructions.BREAKING CHANGES
Archived instructions are left out of the client. Instructions with an
archivedstatus, along with their sub-instructions, are no longer rendered, exported, identified or exposed by the program plugin, as the Codama standard specifies. Parents whose sub-instructions are all archived are rendered as leaves.Instruction builders and program plugin methods are documented with the
docsof their instruction. Deprecated instructions get a@deprecatedtag with their status message, so that editors flag their usages, and draft instructions an@experimentaltag.Instructions with
returnDataget a type and codecs to decode the data they return, named through the newinstructionReturnDataTypename transformer, e.g.getTransferInstructionReturnDataDecoder.#315
2587c34Thanks @lorisleiva! - Name generated files in kebab-case by default, following the identifiers of Codama v2 which keep their original casing.BREAKING CHANGES
Generated files are named in kebab-case. Imports from the generated folder barrels are unaffected, but deep imports of individual files must be updated.
To keep the previous camelCase file names, override the
fileNamename transformer.#337
d1bb0f9Thanks @lorisleiva! - Escape and validate IDL values written into generated code.BREAKING CHANGES
Attributes rendered as they are must hold a value of their type. Sizes, offsets, counts, error codes, account flags, number formats, bytes encodings, strategies, lifecycles, and integer and float values that do not match their type, e.g. a size given as a string, throw
CODAMA_ERROR__RENDERERS__UNSUPPORTED_NODEinstead of being rendered as they are. Error codes must be non-negative integers.Docs escape comment terminators, e.g.
src/**/*.ts, and addresses, string values and error messages are rendered as escaped string literals.#330
4765fecThanks @lorisleiva! - Export the types of the renderer options and applyinternalNodesto PDAs.BREAKING CHANGES
Custom data options name their node with an
identifier. The objects of thecustomAccountDataandcustomInstructionDataoptions useidentifierrather thanname, as Codama v2 nodes do.Internal PDAs are not exported. PDAs listed in
internalNodesare rendered but no longer exported from thepdasbarrel, like other internal nodes. A root barrel exporting nothing but PDAs now exports them too.The package now exports the
CustomDataOptions,LinkOverrides,PrettierOptionsandFragmenttypes, along with theParsedCustomDataOptionsandGetImportFromFunctiontypes of its scope.#322
41511baThanks @lorisleiva! - Render type nodes and values that previously produced code failing to compile or encoding the wrong bytes.BREAKING CHANGES
Values are rendered for their type. Constants, default values, PDA seeds and enum payloads render each nested value for the type it is used as, so 64-bit integers nested within options, arrays, tuples, maps, sets or structs are
bigintliterals and SOL amounts areLamports.Constants holding a value of a data union, including field discriminator constants, e.g.
command('Wait', [30]), are typed as the loose type of the union, which its helper returns.Scalar enums nested within structs render as data unions. An enum without data defined inline within a struct, rather than as a defined type, has no name to declare a native
enum, so its values are{ __kind: 'Fast' }objects instead of code that did not compile.Nested fields named like a field discriminator keep their own default value. Only the top-level field of the data of an account, event or instruction is filled in with its discriminator constant.
Event discriminators that are not raw bytes are matched by their encoded bytes. Event codecs and parse helpers call the
get…DiscriminatorBytes()function of such discriminators, e.g. au8or a string, instead of comparing their value with the event data.The byte order of single-byte and variable-length integers is ignored. Big-endian
u8,i8andshortU16integers render the same codecs as little-endian ones, which accept no byte order.Zeroable options with a zero value of their item's size are fixed-size. Their codecs are wrapped in
fixEncoderSizeandfixDecoderSize, so that types and accounts holding them keep a fixed size.#313
fd1e9b6Thanks @lorisleiva! - Render the instructions of the Codama v2 standard. Instruction arguments are read from the fields of the instructiondata, extra arguments fromcodama.extraArgumentplugins, and resolvers fromcodama.resolverplugins on accounts, data fields, extra arguments, remaining accounts and byte deltas, so that IDLs upgraded from v1 render the same instruction builders as before. Defaults injected from theprovidesof an instruction are resolved like any other default, and references to instruction data may point to nested fields, e.g.args.config?.fee.BREAKING CHANGES
Upgraded defaults that mixed a resolver with other values require a new resolver. When a v1 default could not be expressed without a resolver, e.g. a conditional value whose condition is a resolver, or a byte delta given by an extra argument,
@codama/upgradereplaces it with a resolver resolving the whole value, named after the instruction and the input, e.g.resolveCreateByteDelta. Generated builders call that resolver, which you must provide alongside your existing ones, e.g. throughlinkOverrides.resolvers.Malformed plugins and unsupported injections throw. A
codama.resolverorcodama.extraArgumentplugin whose payload does not match the spec, instruction data that is neither a struct nor a defined type link, and a value provided for an injected default nested within instruction data, which builders cannot fill in, throwCODAMA_ERROR__RENDERERS__UNSUPPORTED_NODEwith the path of the offending node.